﻿#region

using System.Xml;
using System.Xml.Serialization;
using DotNetMax.CodeGen.Model.Collection;

#endregion

namespace DotNetMax.CodeGen.Model.Entity
{
    /// <summary>
    /// Entidade de Projeto
    /// </summary>
    public class Project : ExtendedBaseEntity
    {
        #region Constructor

        public Project()
        {
        }

        public Project(string type)
        {
            _Type = type;
        }

        public Project(string filePath, string name, string type) : base(filePath, name)
        {
            _Type = type;
        }

        public Project(XmlDocument medataData, string type) : base(medataData)
        {
            _Type = type;
        }

        public Project(string filePath, string name, XmlDocument medataData, string type)
            : base(filePath, name, medataData)
        {
            _Type = type;
        }

        public Project(string filePath, string name, string guid, XmlDocument medataData, string type)
            : base(filePath, name, guid, medataData)
        {
            _Type = type;
        }

        public Project(string filePath, string name, string guid, string type) : base(filePath, name, guid)
        {
            _Type = type;
        }

        #endregion

        #region Fields

        private FileInProjectCollection _FilesInCurrentProject = new FileInProjectCollection();
        private string _Type;
        private ProjectFileCollection _Files = new ProjectFileCollection();
        private ProjectBuildStatistics _BuildStatistics = new ProjectBuildStatistics();

        #endregion

        #region Properties

        /// <summary>
        /// Retorna o Tipo do Projeto
        /// </summary>
        [XmlAttribute("Type")]
        public string Type
        {
            get { return _Type; }
            set { _Type = value; }
        }

        /// <summary>
        /// Contém a Referência aos Arquivos de um Projeto
        /// </summary>
        [XmlArray("FilesInCurrentProject")]
        [XmlArrayItem("FileInCurrentProject")]
        public FileInProjectCollection FilesInCurrentProject
        {
            get { return _FilesInCurrentProject; }
            set { _FilesInCurrentProject = value; }
        }

        /// <summary>
        /// Contém as Estatísticas de Compilação
        /// </summary>
        [XmlElement("BuildStatistics")]
        public ProjectBuildStatistics BuildStatistics
        {
            get { return _BuildStatistics; }
            set { _BuildStatistics = value; }
        }

        /// <summary>
        /// Contém os Arquivos do Projeto
        /// </summary>
        [XmlIgnore]
        public ProjectFileCollection Files
        {
            get { return _Files; }
            set { _Files = value; }
        }

        #endregion
    }
}